package cn.dinkevin.xui.util;

import java.util.Random;
import java.util.UUID;

/**
 * 随机数工具类
 * Created by ChengPengFei on 2017/2/16 0016.</br>
 * Copyright ©2017 juziwl, All Rights Reserved.
 */

public final class RandomUtil {
    private RandomUtil(){}

    public static String createUUID(){
        return UUID.randomUUID().toString();
    }

    /**
     * 创建随机数字
     * @param length 长度
     * @return
     */
    public static String createNumber(int length){
        StringBuffer buffer = new StringBuffer();
        Random rdn = new Random();
        for(int i = 0;i < length;i++){
            buffer.append(rdn.nextInt(10));
        }
        return buffer.toString();
    }
}
